package com.itheima.controller;

import com.itheima.mydatasource.MyDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/books")
public class BookController {
    @Value("${country}")
    private String country;

    @Autowired
    private Environment en;

    @Autowired
    private MyDataSource myDataSource;

    @GetMapping
    public String getById(){
        System.out.println("springboot running");
        System.out.println("country===>"+country);

        System.out.println(en.getProperty("user2.name"));


        System.out.println("-----------------------");
        System.out.println(myDataSource);
        return "{'module':'spring boot'}";
    }
}
